package com.stedu.service.impl;

import com.stedu.mapper.ModelsMapper;
import com.stedu.service.LikeModelsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class LikeModelsServiceImpl implements LikeModelsService {
    @Autowired
    private ModelsMapper modelsMapper;


    @Override
    public List<Integer> selectIdByMid(Integer mid) {
        return modelsMapper.selectIdByMid(mid);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void insertMidAndId(Integer mid, Integer[] ids) {
    modelsMapper.deleteMidAndId(mid);
    if (ids != null && ids.length>0){
        modelsMapper.insertMidAndId(mid,ids);
    }




    }
}
